<link rel="stylesheet" href="${project_url}/common/kindeditor/themes/default/default.css" />
<script type="text/javascript" src="${project_url}/common/kindeditor/kindeditor.js"></script>
<script type="text/javascript" src="${project_url}/common/kindeditor/lang/zh_CN.js"></script>
<script>
	var kindeditor_pre_url="${project_url}/common/kindeditor";
	KindEditor.ready(function(K) {
		var editor = K.editor({
			fileManagerJson : kindeditor_pre_url+'/jsp/file_manager_json.jsp'
		});
		K('.js-filemanager').click(function() {
			var relation_input_name=K(this).attr("relation_input_name");
			editor.loadPlugin('filemanager', function() {
				editor.plugin.filemanagerDialog({
					viewType : 'VIEW',
					dirName : 'image',
					clickFn : function(url, title) {
						K('#'+relation_input_name).val(url);
						$('#'+relation_input_name+'_img').html("");
						$('#'+relation_input_name+'_img').append("<a href='"+url+"' target='view_window'> <img src='"+url+"' width='100' height='100'></a>");
						//K('#url').val(url);
						editor.hideDialog();
					}
				});
			});
		});
	});
</script>

<#macro fileUpload title input_name file_url project_url>
<div class="row cl">
	<label class="form-label col-2">${title}:</label>
	<div class="formControls col-10">
		<input type="button" relation_input_name="${input_name}"  class="input-text js-filemanager" style="width: 80%" value="点击上传文件" />
	</div>
</div>
<br>
<div class="row cl">
	<label class="form-label col-2"> </label>
	<input id="${input_name}" name="${input_name}" value="${file_url}" type="hidden">
	<div class="formControls col-10" id="${input_name}_img">
		<#if file_url!="">
			<a href="${project_url}/${file_url}" target='view_window'> <img src="${project_url}/${file_url}" width='100' height='100'></a>
		</#if>
	</div>
</div>
<br>
</#macro>
